﻿using Nop.Core.Domain.Vendors;
using Nop.Core.Domain.WindAlert;
using Nop.Services.Localization;
using Nop.Services.Seo;
using Nop.Web.Models.Catalog;
using Nop.Web.Models.Common;
using Nop.Web.Models.WindAlert;

namespace Nop.Web.WindAlert.Extensions
{
    public static class MappingExtensions
    {
        //windalert
        public static CameraModel ToModel(this Camera entity)
        {
            if (entity == null)
                return null;

            var model = new CameraModel()
            {
                Id = entity.Id,
                Name = entity.GetLocalized(x => x.Name),
                Description = entity.GetLocalized(x => x.Description),
                MetaKeywords = entity.GetLocalized(x => x.MetaKeywords),
                MetaDescription = entity.GetLocalized(x => x.MetaDescription),
                MetaTitle = entity.GetLocalized(x => x.MetaTitle),
                SponserName = entity.GetLocalized(x => x.SponserName),
                SponserCameraLink = entity.SponserCameraLink,
                CameraLink = entity.CameraLink,
                SponserLink = entity.SponserLink,
                zIndex = entity.zIndex,
                DisplayOrder = entity.DisplayOrder,
                SeName = entity.GetSeName(),
            };
            return model;
        }

        public static SpotModel ToModel(this Spot entity)
        {
            if (entity == null)
                return null;

            var model = new SpotModel()
            {
                Id = entity.Id,
                Name = entity.GetLocalized(x => x.Name),
                Description = entity.GetLocalized(x => x.Description),
                MetaKeywords = entity.GetLocalized(x => x.MetaKeywords),
                MetaDescription = entity.GetLocalized(x => x.MetaDescription),
                MetaTitle = entity.GetLocalized(x => x.MetaTitle),
                SeName = entity.GetSeName(),
                Published = entity.Published,
                Deleted = entity.Deleted,
                lat = entity.lat,
                lng = entity.lng,
                DisplayOrder = entity.DisplayOrder,
            };
            return model;
        }
    }
}